home *** CD-ROM | disk | FTP | other *** search
- /*
- Copyright (c) 1991, 1992 by NeXT Computer, Inc as an unpublished work.
- All rights reserved.
- */
-
- #import <objc/Object.h>
- #import <ri/ri.h>
- #import <ri/slo.h>
- #import <appkit/graphics.h>
- #import "next3d.h"
-
- @class N3DCamera;
-
- typedef struct {
- char id[6]; /* self, encoded to 6 non-0 bytes */
- char name; /* optional visible name */
- } N3DShapeName;
-
- /* flags for CTM and inverse dirty bits */
- #define N3D_BOTH_CLEAN 0
- #define N3D_CTM_DIRTY 1
- #define N3D_CTM_INVERSE_DIRTY 2
- #define N3D_CTM_BOTH_DIRTY 3
-
- @interface N3DShape : Object
- {
- RtMatrix transform; /* The matrix that's catenated at this node */
- RtMatrix compositeTransform; /* The CTM */
- RtMatrix inverseCompositeTransform; /* The CTM^-1 */
- RtBound boundingBox; /* bounds in 3D */
- N3DShapeName *shapeName;
- N3DSurfaceType surfaceType;
-
- /* Pointers to each kind of shader available */
- id surfaceShader;
- id displacementShader;
- id lightShader;
- id imagerShader;
- id volumeShader;
- id transformationShader;
-
-
- struct {
- unsigned int selectable:1; /* can you select this N3DShape? */
- unsigned int visible:1; /* self and descendants are invisible */
- unsigned int ancestorChanged:1; /* need to update bounds, etc. */
- unsigned int compositeDirty:2; /* flags for CTM & inverse */
- unsigned int drawAsBox:1; /* draw the bbox */
- unsigned int isInstance:1; /* is this an instance of another? */
- unsigned int hasShader:1; /* are there any shaders? */
- unsigned int _emitTransform:1;
- unsigned int _emitSurfaceType:1;
- unsigned int filler:24;
- } shapeFlags;
-
- /* The following are links to other DAGNodes. Really the DAG allows
- traversal to a nextPeer or descendant; the prev and ancestor pointers
- are here for back-linking.
- */
- id nextPeer;
- id previousPeer; /* back link */
- id descendant;
- id ancestor; /* back link */
-
- id renderDelegate; /* set if this Object is an instance */
-
- void *_CTMRel;
- char *_rnm;
- void *_N3Dprivate;
- }
-
- - init;
-
- - linkPeer:aPeer;
- - nextPeer;
- - previousPeer;
- - firstPeer;
- - lastPeer;
-
- - linkDescendant:aDescendant;
- - descendant;
- - lastDescendant;
-
- - linkAncestor:anAncestor;
- - ancestor;
- - firstAncestor;
-
- - unlink;
- - group:toShape;
- - ungroup;
-
- - (BOOL)isWorld;
-
- - setSurfaceType:(N3DSurfaceType)surfaceType andDescendants:(BOOL)flag;
- - (N3DSurfaceType)surfaceType;
-
- - setShader:aShader;
- - shaderType:(SLO_TYPE)type;
-
- - getBoundingBox:(RtBound *)bbox;
- - setDrawAsBox:(BOOL)flag;
- - (BOOL)doesDrawAsBox;
- - getBounds:(NXRect *)sRect inCamera:camera;
- - convertObjectPoints:(RtPoint *)points count:(int)n toCamera:camera;
- - convertPoints:(RtPoint *)points count:(int)n fromAncestor:(N3DShape *)aShape;
- - convertPoints:(RtPoint *)points count:(int)n toAncestor:(N3DShape *)aShape;
-
- - setSelectable:(BOOL)flag;
- - (BOOL)isSelectable;
- - setVisible:(BOOL)flag;
- - (BOOL)isVisible;
-
- - setShapeName:(const char *)aName;
- - (const char *)shapeName;
-
- - setRenderDelegate:anObject;
- - removeRenderDelegate;
- - renderDelegate;
-
- - setTransformMatrix:(RtMatrix)tm;
- - getTransformMatrix:(RtMatrix)tm;
- - concatTransformMatrix:(RtMatrix)ctm premultiply:(BOOL)flag;
- - getCompositeTransformMatrix:(RtMatrix)ctm
- relativeToAncestor:(N3DShape *)aShape;
- - getInverseCompositeTransformMatrix:(RtMatrix)ictm
- relativeToAncestor:(N3DShape *)aShape;
-
- - rotateAngle:(float)ang axis:(RtPoint)anAxis;
- - preRotateAngle:(float)ang axis:(RtPoint)anAxis;
- - scale:(float)sx :(float)sy :(float)sz;
- - preScale:(float)sx :(float)sy :(float)sz;
- - scaleUniformly:(float)s;
- - preScaleUniformly:(float)s;
- - translate:(float)tx :(float)ty :(float)tz;
- - preTranslate:(float)tx :(float)ty :(float)tz;
-
- - render:(N3DCamera *)camera;
- - renderSelf:(N3DCamera *)camera;
- - renderSelfAsBox:(N3DCamera *)camera;
-
- - free;
- - freeAll;
-
- - awake;
- - read:(NXTypedStream *)stream;
- - write:(NXTypedStream *)stream;
-
- @end
-